const yaml = require('js-yaml');

const data = {
	name: 'John Doe',
	age: 30,
	address: {
		street: '123 Main St.',
		city: 'Anytown',
		state: 'CA'
	},
};

const yamlString = yaml.dump(data);
console.log(yamlString);